package com.scau.service.impl.business;

import java.io.Serializable;

import org.springframework.stereotype.Component;

import com.scau.exception.BusinessException;
import com.scau.model.business.MaterialType;
import com.scau.service.BaseService;

@Component
public class MaterialTypeService extends BaseService<MaterialType> implements Serializable{
	public void save(MaterialType mType) throws BusinessException{
		if(null!=mType&&null!=mType.getType_name()){
			if(null!=mType.getId()&&0!=mType.getId()){
				update(mType);
			}else {
				add(mType);
			}
		}else {
			throw new BusinessException("类型名称不能为空");
		}
	}
	
	@Override
	public MaterialType get(MaterialType entity){
		if(null!=entity&&null!=entity.getId()&&0!=entity.getId()){
			return super.get(entity, entity.getId());
		}else if (null!=entity) {
			return super.get(entity);
		}else {
			return null;
		}
	}
}
